<?php
/**
 * login actions.
 *
 * @package    ehockey
 * @subpackage login
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class loginActions extends sfActions
{
	public function executeIndex(sfWebRequest $request)
	{
		$this->form = new LoginForm();
		if ($request->isMethod("post")) {
			$this->form->autoBind();
			if ($this->form->isValid()) {
				$this->getUser()->setUsuario($this->form->getValue('usuario'));
				$this->redirect($this->form->getValue('redirect_to'));
			}
		}
	}

	public function executeLogout(sfWebRequest $request) {
		$this->getUser()->setUsuario(NULL);
		$this->redirect('@homepage');
	}
}
